.
<!-- 菜单弹框 -->
<form id="menus-form" lay-filter="menus-form" class="layui-form model-form">
    <input name="id" type="hidden"/>

    <div class="layui-form-item">
        <label class="layui-form-label">工位名称</label>
        <div class="layui-input-block">
            <input name="stname" placeholder="请输入工位名称" type="text" class="layui-input" maxlength="50"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">价格</label>
        <div class="layui-input-block">
            <input name="prices" placeholder="请输入价格" type="text" class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">工位介绍</label>
        <div class="layui-input-block">
            <input name="conten" placeholder="请输入工位介绍" type="text" class="layui-input"/>
        </div>
    </div>

    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="menus-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'config', 'form', 'formSelects', 'upload'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var config = layui.config;
        var form = layui.form;
        var formSelects = layui.formSelects;
        var upload = layui.upload;
        upload.render({
            elem: '#img'
            , url: config.base_server + 'api-file/files-anon' //改成您自己的上传接口
            , done: function (res) {
                console.log(res);
                $("#showImg").attr("src", "http://ocalhost:10000/api/o" + res.data);
                sessionStorage.setItem("url", res.data);

            }
            , error: function () {
                //异常回调
            }
        });
        debugger;
        form.render('radio');

        // 获取一级地址
        layer.load(2);
        admin.req('api-administrators/station/getAddress', {}, function (data) {
            console.log(data.data.data);
            layer.closeAll('loading');
            if (0 == data.code) {

                $.each(data.data.data, function (index, item) {
                    $('#select').append(new Option(item.ccname, item.regiid));//往下拉菜单里添加元素
                })

                form.render();  //菜单渲染 把内容加载进去

                // 回显user数据
                var menus = admin.getTempData('t_menus');
                console.log(menus);
                $('#menus-form').attr('method', 'POST');
                if (menus) {

                    form.val('menus-form', menus);
                    $('#menus-form').attr('method', 'POST');
                }
            } else {
                layer.msg('获取一级菜单', {icon: 2, time: 500});
            }
        }, 'GET');
        form.on('select(college)', function (data) {
            admin.req('api-administrators/station/findLow', {regiid: data.value}, function (data) {
                console.log(data.data.data);
                layer.closeAll('loading');
                $("#select1").empty();
                if (0 == data.code) {
                    $.each(data.data.data, function (index, item) {
                        $('#select1').append(new Option(item.ccname, item.addrid));//往下拉菜单里添加元素
                    })
                    form.render();  //菜单渲染 把内容加载进去
                }
            }, 'GET');
        });


        // 表单提交事件
        form.on('submit(menus-form-submit)', function (data) {
            layer.load(2);
            admin.req('api-manage/menus/saveOrUpdate', JSON.stringify(data.field), function (data) {

                if (data.code == 0) {
                    layer.closeAll('loading');
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.closeAll('loading');
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, $('#menus-form').attr('method'));
            return false;
        });


    });
</script>